﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using ESRI.ArcGIS.ADF.BaseClasses;
using PlanningGIS.Framework;

namespace PlanningGIS.Product
{
    /// <summary>
    /// 
    /// </summary>
    public class CreateMapsheetCommand : BaseCommand
    {
        /// <summary>
        /// 
        /// </summary>
        IApplication m_Application = null;
        /// <summary>
        /// 
        /// </summary>
        public CreateMapsheetCommand()
        {
            m_caption = "创建图幅";
            m_toolTip = m_caption;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hook"></param>
        public override void OnCreate(object hook)
        {
            if (m_Application == null)
            {
                m_Application = hook as IApplication;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public override void OnClick()
        {
            PlanningGIS.MapSheet.FrmMapSheet frm = new PlanningGIS.MapSheet.FrmMapSheet();           
            frm.Show((m_Application as IFramework).MdiForm);
        }
        /// <summary>
        /// 图标
        /// </summary>
        public override int Bitmap
        {
            get
            {
                string bitmapResourceName = "PlanningGIS.Product.Resources." + this.GetType().Name + ".ico";
                System.IO.Stream pStream = GetType().Assembly.GetManifestResourceStream(bitmapResourceName);
                if (pStream == null) return 0;
                return new Bitmap(pStream).GetHbitmap().ToInt32();
            }
        }
        /// <summary>
        /// 可用状态
        /// </summary>
        public override bool Enabled
        {
            get
            {
                return true;
            }
        }
    }
}
